<!DOCTYPE html>
<html ng-app="app" ng-controller="indexCtrl">

	<head lang="en">
		<meta charset="UTF-8">
		<meta http-equiv="Expires" content="0">
		<meta http-equiv="Pragma" content="no-cache">
		<meta http-equiv="Cache-control" content="no-cache">
		<meta http-equiv="Cache" content="no-cache">
		<title>广告投放-广告主</title>
		<link rel="shortcut icon" href="favicon.ico" type="image/x-icon" id="favicon">
		<link rel="stylesheet" href="lib/bootstrap/css/bootstrap.min.css" />
		<link rel="stylesheet" href="css/bootstrap-datetimepicker.min.css" />
		<link rel="stylesheet" href="css/base.css" />
		<link rel="stylesheet" href="modules/agent/agOrder/agOrder.css" />
		<link rel="stylesheet" href="../../oem/css/common.css" />
		<style>
			.hide {
				display: none;
			}
			
			.show {
				display: block;
			}
		</style>
	</head>

	<body>
		<div class="nav_top">
			<div class="logo fl" id="logo">
			</div>
			<ul class="nav_list fl">
		
				<li ng-if="permission.view['首页']" class="ng-scope">
					<a ui-sref="agent.home" ui-sref-active="active" href="./agentIndex.html" class="">首页</a>
				</li>
			
				<li ng-if="permission.view['投放管理']" class="ng-scope">
				
					<a href="./active.html" class="toFirstSub active">投放管理</a>
					<ul class="nav_dropdown" style="width: 1903px;">
				
						<li ng-if="permission.view['投放管理'].sub['活动管理']" class="ng-scope">
							<a href="./active.html" ui-sref-active="active" ui-sref="agent.delivery.active" class="">活动管理</a>
						</li>
					
						<li ng-if="permission.view['投放管理'].sub['订单管理']" class="ng-scope">
							<a href="./order.html" ui-sref-active="active" ui-sref="agent.delivery.order" class="">订单管理</a>
						</li>
				
						<li ng-if="permission.view['投放管理'].sub['素材信息']" class="ng-scope">
							<a href="./creative.html" ui-sref-active="active" ui-sref="agent.delivery.creative" class="">素材信息</a>
						</li>
				
						<li ng-if="permission.view['投放管理'].sub['APP监测']" class="ng-scope">
							<a href="./audiences.html" ui-sref-active="active" ui-sref="agent.delivery.audiences" class="">监测管理</a>
						</li>
				
					</ul>
				</li>
			
				<li ng-if="permission.view['报表中心']" class="ng-scope">
				
					<a href="./baoBiao.html" class="toFirstSub" ng-class="{'active':$state.includes('agent.report.*')}">报表中心</a>
					<ul class="nav_dropdown" style="width: 1903px;">
		
						<li ng-if="permission.view['报表中心'].sub['效果报表']" class="ng-scope">
							<a href="./baoBiao.html" ui-sref-active="active" ui-sref="agent.report.effect({'activeID':'0','activeName':'0','orderID':'0','orderName':'0'})" class="">效果报表</a>
						</li>
						<li ng-if="permission.view['合约报表'].sub['效果报表']" class="ng-scope">
							<a href="./heyuebaobiao.html" ui-sref-active="active" ui-sref="agent.report.effect({'activeID':'0','activeName':'0','orderID':'0','orderName':'0'})" class="">合约报表</a>
						</li>

					</ul>
				</li>
			
				<li ng-if="permission.view['系统管理']" class="ng-scope">
					<a href="./baseInfo.html" class="toFirstSub" ng-class="{'active':$state.includes('agent.manage.*')}">系统管理</a>
					<ul class="nav_dropdown" style="width: 1903px;">
				
						<li ng-if="permission.view['系统管理'].sub['基本信息']" class="ng-scope">
							<a href="./baseInfo.html" ui-sref-active="active" ui-sref="agent.manage.baseInfo" class="">基本信息</a>
						</li>
				
						<li ng-if="permission.view['系统管理'].sub['资质管理']" class="ng-scope">
							<a href="./qualifications.html" ui-sref-active="active" ui-sref="agent.manage.qualifications" class="">资质管理</a>
						</li>
				
					</ul>
				</li>
			
				<li ng-if="permission.view['财务管理']" class="ng-scope">
				
					<a href="./caiwu.html" class="toFirstSub" ng-class="{'active':$state.includes('agent.finance.*')}">财务管理</a>
					<ul class="nav_dropdown" style="width: 1903px;">
				
						<li ng-if="permission.view['财务管理'].sub['财务信息']" class="ng-scope">
							<a href="./caiwu.html" ui-sref-active="active" ui-sref="agent.finance.trade" class="">财务信息</a>
						</li>
					
					</ul>
				</li>
		
			</ul>
			<div class="user">
				<div class="user-avatar"></div>
				<div class="user-info">
					<p ng-bind="advUser.loginName" class="ng-binding">昌投网络科技-C1</p>
					<p ng-bind="advUser.name" class="ng-binding">上海昌投网络科技有限公司1</p>
				</div>
				<ul class="user-list">
					<li class="ng-binding">余额：</li>
					<li ng-show="permission.act['退出登录']" ng-click="logout()" class="">退出登录</li>
				</ul>
			</div>
		</div>
		<ui-view class="ng-scope">
			<!-- uiView:  -->
			<ui-view class="ng-scope">
				<!-- uiView:  -->
				<ui-view class="ng-scope">
					<div class="order-page page ng-scope">

						<!--页面标题-->
						<h3 class="page-title">订单管理</h3>
						<div class="filter-box">
							<button ng-if="permission.act[&quot;订单&quot;].sub[&quot;新建竞价订单&quot;] || permission.act[&quot;订单&quot;].sub[&quot;新建合约订单&quot;]" class="dsp-btn btn-blue new-order ng-scope" onclick="newOrder()">
                            新建订单
                        </button>

						</div>
						<div class="filter-box">

							<div class="dropdown dropdown-filter ng-isolate-scope" ng-class="{disabled:disabled}" list="statusList" callback="statusCall"> <button class="btn btn-default dropdown-toggle cl" data-toggle="dropdown"> <span style="width: 55%; display: inline-block;"
                                    class="ng-binding" id='dingDanZhuangTai'>订单状态</span>
                            </button> <span class="caret"></span>
								<ul class="dropdown-menu">

									<li class="cl ng-scope" ng-repeat="item in list" onclick="clickFunc1(this)">
										<a title="全部" href="javascript:;" class="ng-binding" data-state=null>全部</a>
									</li>
									<!-- 待投放 -->
									<li class="cl ng-scope" ng-repeat="item in list" onclick="clickFunc1(this)">
										<a title="开启" href="javascript:;" class="ng-binding" data-state='0'>开启</a>
									</li>
									<!-- 投放中 -->
									<li class="cl ng-scope" ng-repeat="item in list" onclick="clickFunc1(this)">
										<a title="关闭" href="javascript:;" class="ng-binding" data-state='1'>关闭</a>
									</li>

								</ul>
							</div>
							<div class="dropdown dropdown-input ng-isolate-scope" value="searchActive" list="activeList" placeholder="全部活动" click-callback="activeCall" key-up-callback="activeUp"> <input id="search_content" class="form-control dropdown-toggle ng-pristine ng-untouched ng-valid ng-empty" data-toggle="dropdown" ng-blur="blurFunc(value)" ng-model="value" ng-keyup="keyUp($event,value)" placeholder="全部活动"> <span class="caret"></span>
								<ul class="dropdown-menu" id='huoDongChildrenBox'>

								</ul>
							</div>

						</div>
					
						<!--表格-->
						<div class="table-box">
							<div class="table-title">
								<h3 class="table-title-font">订单列表</h3>
							</div>
							<table>
								<thead>
									<tr>

										<th>状态</th>
										<th>ID</th>
										<th>竞价类型</th>
										<th>订单类型</th>
										<th>名称</th>
										<th>所属活动</th>
										<th>总预算</th>
										<th>频次</th>
										<th>投放速率</th>
										<th>出价</th>
										<th>总花费（元）</th>
										<th>操作</th>
									</tr>
								</thead>

								<tbody id='order_list_box'>

								</tbody>
							</table>
							<div id="pageToolbar" class="page">
								<div id="Paging_05808439448215164" class="ui-paging-container">
									<ul>
										<li class="js-page-first js-page-action ui-pager ui-pager-disabled">首页</li>
										<li class="js-page-prev js-page-action ui-pager ui-pager-disabled">上一页</li>
										<li data-page="1" class="ui-pager focus">1</li>
										<li class="ui-paging-toolbar"><span>跳转到</span><input type="text" class="ui-paging-count"> 页
											<select class="ui-select-pagesize">
												<option value="20">每页展示20条/页</option>
												<option value="50">每页展示50条/页</option>
												<option value="100">每页展示100条/页</option>
											</select><span> </span></li>
										<li class="js-page-last js-page-action ui-pager ui-pager-disabled">末页</li>
										<li class="js-page-next js-page-action ui-pager ui-pager-disabled">下一页</li>
									</ul>
								</div>
							</div>

						</div>

						<div class="diagnosis-box" style="display: none;">
							<div class="title">
								<span class="ng-binding">诊断结果（ID：）</span>
								<i class="icon-close fr" onclick="layer.closeAll();"></i>
							</div>

							<div class="diagnosis-cancel">
								<button class="dsp-btn btn-white2" onclick="layer.closeAll();">取消</button>
							</div>
						</div>
						<!-- 复制订单弹框 -->
						<div class="copy-order-box">
							<div class="form-group">
								<label>订单名称：</label>
								<input type="text" id="copyOrderName" class="form-control ng-pristine ng-untouched ng-valid ng-empty">
								<div class="check ng-isolate-scope checked"><b></b><span ng-transclude=""><span class="ng-scope">复制此订单下的创意</span></span>
								</div>
							</div>
							<div class="btn-box">
								<button onclick="layer.closeAll()" class="dsp-btn btn-white2">取消</button>
								<button onclick="copyOrder1()" class="dsp-btn btn-blue">确定</button>
							</div>
						</div>

						<div class="iframe-box">
							<iframe srcdoc="" frameborder="0"></iframe>
						</div>

					</div>
				</ui-view>
			</ui-view>
		</ui-view>

	</body>

</html>
<script src="../res1.hubcloud.com.cn/lib/jquery/jquery.min.js"></script>
<script src="js/js_1.js"></script>
<script src="../res1.hubcloud.com.cn/lib/layer/layer.js"></script>

<script>
	var page = 1; //第几页
	var pageSize = 20; //一页多少条
	var state = ''; //搜索状态
	var name = ''; //活动名称
	var allPageNum = ''; //总页数

	$(function() {

		$('.dropdown').on('click', function() {
			if($(this).hasClass("open")) {
				$(this).removeClass('open');
			} else {
				$('.dropdown').removeClass('open');
				$(this).addClass('open');
			}
		})

		// isBenDiData();

		getOrderData(page, pageSize, name, state);
		isBenDiData();

	})

	//判断是否从活动管理点击名称进入到订单管理。（本地是否存order_search_content）
	function isBenDiData() {
		let order_search_content = localStorage.getItem("order_search_content");
		if(order_search_content) {
			$('#search_content').val(order_search_content);
		}
		$.ajax({
			type: "GET",
			url: url + "/advertiser/adActivity/allAdActivity",

			//		参数需转为字符串
			// data: JSON.stringify(d),

			//		json跨域
			dataType: 'json',
			//		contentType类型为json
			contentType: "application/json",

			//		请求头加上X-Token 
			 beforeSend: function(XMLHttpRequest) {
				//		token 为页面所获取
				let token = sessionStorage.getItem("token");
				XMLHttpRequest.setRequestHeader("X-Token", token); 
			},
			useDefaultXhrHeader: false,
			success: function(result) {

				let html = '';
				let listData = result.data;
				listData.forEach(item => {
					html += `<li  onclick="clickFuncHuo(this)" class="ng-scope">
                                <a data-id='${item.id}' href="javascript:;" class="ng-binding">${item.name}</a>
                            </li>`;

				})
				$('#huoDongChildrenBox').append(html);
			},
			err: function(err) {
				layer.msg("请求失败");
			},
			complete: function() {
				// $(_that).removeAttr("disabled");
			}
		});

	}

	function clickFunc1(e) {

		$('#dingDanZhuangTai').text($(e).children('a').text());
		let state = $(e).children('a').attr('data-state');
		sessionStorage.setItem("dingDanZhuangTai", state);
		getOrderData(page, pageSize, name, state);

	}

	function clickFuncHuo(e) {
		$('#search_content').val($(e).children('a').text());
		let huoDongId2 = $(e).children('a').attr('data-id');
		sessionStorage.setItem("huoDongId2", huoDongId2);
		getOrderData(page, pageSize, $('#search_content').val(), state);
	}

	//获取订单数据

	function getOrderData(page, pageSize, name, state) {


		var d = {};
		d.page = page;
		d.pageSize = pageSize;
		d.bidType = 1;
		if(name != '') {
			d.name = name;
		}
		if(state != '') {
			d.orderState = state;
		}

		$.ajax({
			url: url + "/advertiser/adOrderInfo/pageAdorderInfoType",
			// url: url + "/common/industrySmall/"+id,
			type: 'POST',
			//		参数需转为字符串
			data: JSON.stringify(d),
			//		json跨域
			dataType: 'json',
			//		contentType类型为json
			contentType: "application/json",

			//		请求头加上X-Token 
			beforeSend: function(XMLHttpRequest) {
				//		token 为页面所获取
				let token = sessionStorage.getItem("token");
				XMLHttpRequest.setRequestHeader("X-Token", token);
			},
			useDefaultXhrHeader: false,
			success: function(result) {

				$('#order_list_box').html('');
				let html = '';
				let listData = result.data.rows;
//				console.log(result.data);

				for(var i = 0; i < result.data.rows.length; i++) {
					html += '<tr style="cursor: pointer;">';
					html += '<td style="min-width: 85px;">';
					html += '<span class="close fl" onclick="showSpace(this);"></span>';
					var isOpens = '';
					if(result.data.rows[i].orderState == 0) {
						isOpens = 'open';
					}
					html += '<div><div class="switch ng-isolate-scope ' + isOpens + '" onclick="gengGaiZhuangTai(this)" data-id=' + result.data.rows[i].id + ' value="item" index="0"></div></td>';
					html += '<td>' + result.data.rows[i].id + '</td>';
					html += '<td><p>竞价交易</p></td>';
					if(result.data.rows[i].orderType ==1){
						html +='<td>CPM</td>';
					}else{
						html +='<td>CPC</td>';
					}
					html += '<td class="frequency"><div>' + result.data.rows[i].orderName + '</div></td>';
					html += '<td>' + result.data.rows[i].name + '</td>';
					var isallBudget = '无限制';
					if(result.data.rows[i].allBudget) {
						isallBudget = result.data.rows[i].allBudget;
					}
					html += '<td>' + isallBudget + '</td>';
					
					if(result.data.rows[i].times) {
						html += '<td>'+result.data.rows[i].times+'/'+result.data.rows[i].tunit+ '</td>';
					}else{
						html += '<td>无限制</td>';
					}
					if(result.data.rows[i].launchSpeed == 1){
						if(result.data.rows[i].launchTimes){
							html += '<td><span>加速&nbsp;' + result.data.rows[i].launchTimes +'/'+ result.data.rows[i].launchUnit+'</span></td>';
						}else{
							html += '<td><span>无限制</span></td>';
						}
					}else{
						if(result.data.rows[i].launchTimes){
							html += '<td><span>匀速&nbsp;' + result.data.rows[i].launchTimes + result.data.rows[i].launchUnit+'</span></td>';
						}else{
							html += '<td><span>无限制</span></td>';
						}					
					}
				
					
					
					html += '<td class="frequency"><div>' + result.data.rows[i].orderMoney + '</div></td>';
					html += '<td>' + result.data.rows[i].expenditure + '</td>';
					html += '<td><a href="javascript:void(0)" data-id="' + result.data.rows[i].id + '" onclick="deleteList(' + result.data.rows[i].id + ')">删除</a>';
					html += '<a onclick="editOrder(' + result.data.rows[i].id + ')" href="javascript:void(0);">编辑</a>';
					html += '<a onclick="copyOrder(' + result.data.rows[i].id + ')" href="javascript:void(0);">复制订单</a>';
					html += '<a href="baoBiao.html?id=' + result.data.rows[i].id + '">查看报表</a></td></tr>';
					html += '<tr class="table-responsive hide">';
					html += '<td colspan="99" class="secondTd">';
					html += '<table class="table spaceTable"><thead>';
					html += '<tr><th style="padding-left: 87px;">素材</th>';
					html += '<th>创意信息</th><th>素材内容</th><th>审核状态</th></tr></thead>';
					html += '<tbody>';
					for(var k = 0; k < result.data.rows[i].adOrderOris.length; k++) {
						var neishenstate = result.data.rows[i].adOrderOris[k].state;
						var isiginalityType = result.data.rows[i].adOrderOris[k].originalityType;
						var isImg = "图片";
						var isshowImg = 'showImg';
						if(neishenstate == 0){
							neishenstate = '待审核';
						}else if(neishenstate == 1){
							neishenstate = '审核通过';
						}else{
							neishenstate = '审核拒绝';
						}
						
						html += '<tr><td class="spaceInfo">';
						html += '<div class="material-cover" style="background-image: url(&quot;' + result.data.rows[i].adOrderOris[k].photoUrl + '&quot;);">';
                                                if(isiginalityType == 2){
							isImg = "视频";
							isshowImg = "showImg2";
                                                        html += "<video src="+ result.data.rows[i].adOrderOris[k].photoUrl +"></video>";
						}
						html += ' <div class="material-cover-mask" onclick="'+isshowImg+'(this)"></div><input type="hidden" value="'+result.data.rows[i].adOrderOris[k].photoUrl+'"/></div></td>';
						html += '<td class="spaceInfo">';
						html += '<span>创意名称：' + result.data.rows[i].adOrderOris[k].originalityName + '</span><br><br>';
						html += '<span>创意ID：' + result.data.rows[i].adOrderOris[k].id + '</span><br><br>';
						if(result.data.rows[i].adOrderOris[k].originalityAdType == 0){
							html += '<span>广告位类型：Banner </span><br><br>';
						}else if(result.data.rows[i].adOrderOris[k].originalityAdType == 1){
							html += '<span>广告位类型：原生 </span><br><br>';
						}else if(result.data.rows[i].adOrderOris[k].originalityAdType == 2){
							html += '<span>广告位类型：开屏 </span><br><br>';
						}else if(result.data.rows[i].adOrderOris[k].originalityAdType == 3){
							html += '<span>广告位类型：插屏 </span><br><br>';
						}
						html += '</td>';
						html += '<td><div><div><span>'+isImg+'：</span>';
						html += '<a href="javascript:;" onclick="'+isshowImg+'(this)">查看'+isImg+'</a>';
						html += '<input type="hidden" value="'+result.data.rows[i].adOrderOris[k].photoUrl+'"/><br><br></div></div>';
						
						html += '<div>曝光监测：' + result.data.rows[i].adOrderOris[k].exposureMonitor + '<br><br></div>';
						html += '<div style="cursor:pointer;" onclick="toldy(\''+result.data.rows[i].adOrderOris[k].squeezePage+'\')">落地页：' + result.data.rows[i].adOrderOris[k].squeezePage + '<br><br></div></td>';
						html += '<td class="btns"><span class="audit audit-orange">内审状态<span class="audit-text">'+neishenstate+'</span></span>';
						
					}
					html += '</tbody></table></td></tr>';
				}

				$('#order_list_box').append(html);
				
			},
			err: function(err) {
				layer.msg("请求失败");
			},
			complete: function() {
				// $(_that).removeAttr("disabled");
			}
		});
	}
	function toldy(url){
		var boor = url.indexOf("http://");
		if(url){
			if(boor == -1){
				window.location.href='http://'+url
			}else{
				window.location.href=url
			}
		}
	}
	function showImg(obj) {
		let src = $(obj).next().val();

		layer.open({
			type: 1,
			title: false,
			closeBtn: 0,
			area: '516px',
			skin: 'layui-layer-nobg', //没有背景色
			shadeClose: true,
			content:'<img src="' + src + '"></img>'
			
		});
	}
	
	function showImg2(obj) {
		let src = $(obj).next().val();

		layer.open({
			type: 1,
			title: false,
			closeBtn: 0,
			
			skin: 'layui-layer-nobg', //没有背景色
			shadeClose: true,
			content:'<video width="320" height="240" controls><source src="'+src+'" type="video/mp4"><source src="'+src+'" type="video/ogg"></video>'
			
		});
	}
	function showSpace(e) {

		if($(e).hasClass('icon-open')) {
			$(e).removeClass('icon-open');
			$(e).parent().parent().next().addClass('hide');
		} else {
			$(e).addClass('icon-open');
			$(e).parent().parent().next().removeClass('hide');
		}
	}
	function editOrder(str){
//		console.log(str)
		sessionStorage.setItem('orderBianJiId', str);
		location.href = "editOrder.html";
	}


	//编辑事件
	function bianJi(e) {

		//阻止冒泡事件
		window.event ? window.event.cancelBubble = true : e.stopPropagation();
		let orderBianJiId = $(e).attr('data-id');
		sessionStorage.setItem('orderBianJiId', orderBianJiId);
		location.href = "./newOrder.html";
	}
	//删除订单 
	function deleteList(infoId) {
		var token = sessionStorage.getItem("token");
		var param3 = "/advertiser/adOrderInfo/deletOrder?infoId=" + infoId;

		$.ajax({
			url: url + param3,
			type: "post",
			dataType: 'json',

			contentType: "application/json",
			useDefaultXhrHeader: false,
			 beforeSend: function(XMLHttpRequest) {
				XMLHttpRequest.setRequestHeader("X-Token", token); 
			},
			success: function(result) {
				if(result.code == '0') {

					layer.msg(result.msg, {
						time: 2 * 1000
					}, function() {
						window.location.reload();
					});
				}
			}
		});
	}
	//复制订单
	function copyOrder(orderId) {
		var token = sessionStorage.getItem("token");
		var param3 = "/advertiser/adOrderInfo/coptAdorderById?infoId=" + orderId;

		$.ajax({
			url: url + param3,
			type: "post",
			dataType: 'json',

			contentType: "application/json",
			useDefaultXhrHeader: false,
			 beforeSend: function(XMLHttpRequest) {
				XMLHttpRequest.setRequestHeader("X-Token", token); 
			},
			success: function(result) {
				if(result.code == '0') {

					layer.msg(result.msg, {
						time: 2 * 1000
					}, function() {
						window.location.reload();
					});
				}
			}
		});

	}

	function copyOrder1() {
		let copyOrderId = sessionStorage.getItem('copyOrderId');

		$.ajax({
			type: "POST",
			url: url + "/advertiser/adOrderInfo/coptAdorderById?infoId=" + copyOrderId,

			//		参数需转为字符串
			// data: JSON.stringify(d),

			//		json跨域
			dataType: 'json',
			//		contentType类型为json
			contentType: "application/json",

			//		请求头加上X-Token 
			 beforeSend: function(XMLHttpRequest) {
				//		token 为页面所获取
				let token = sessionStorage.getItem("token");
				XMLHttpRequest.setRequestHeader("X-Token", token); 
			},
			useDefaultXhrHeader: false,
			success: function(result) {
				console.log(result);

				if(result.code == '0') {
					layer.closeAll();
					layer.open({
						title: '提示',
						icon: '1',
						content: result.msg,
						time: 1500,
						end: function() { 
							location.href = 'order.html';        
						}
					});
				}

				// let html = '';
				// let listData=result.data;
				// listData.forEach(item => {
				//     html +=`<li  onclick="clickFuncHuo(this)" class="ng-scope">
				//                 <a data-id='${item.id}' href="javascript:;" class="ng-binding">${item.name}</a>
				//             </li>`;

				// })
				// $('#huoDongChildrenBox').append(html);        
			},
			err: function(err) {
				layer.msg("请求失败");
			},
			complete: function() {
				// $(_that).removeAttr("disabled");
			}
		});

	}

	function newOrder() {
		location.href = "./newOrder.html";
	}

	//修改状态
	function gengGaiZhuangTai(e) {
		//阻止冒泡事件
		window.event ? window.event.cancelBubble = true : e.stopPropagation();
		let id = $(e).attr("data-id");
		if($(e).hasClass("open")) {
			$(e).removeClass('open');
			updateAdorderInfoById(id, 1)
		} else {
			$(e).addClass('open');
			updateAdorderInfoById(id, 0)
		}
	}

	//根据订单ID更改订单状态

	function updateAdorderInfoById(id, state) {
		let token = sessionStorage.getItem("token");
		var d = {};
		d.id = id;
		d.orderState = state;
		$.ajax({
			url: url + "/advertiser/adOrderInfo/updateAdorderInfoById",
			// url: url + "/common/industrySmall/"+id,
			type: 'POST',
			//		参数需转为字符串
			data: JSON.stringify(d),
			//		json跨域
			dataType: 'json',
			//		contentType类型为json
			contentType: "application/json",

			//		请求头加上X-Token 
			 beforeSend: function(XMLHttpRequest) {
				//		token 为页面所获取
				XMLHttpRequest.setRequestHeader("X-Token", token); 
			},
			useDefaultXhrHeader: false,
			success: function(result) {

				if(result.code == '0') {
					layer.msg(result.msg);
				} else {
					layer.msg(result.msg);
				}
			},

			complete: function() {
				// $(_that).removeAttr("disabled");
			}
		});
	}
</script>
<script>
	$('.user').on('click', function() {
		$(this).toggleClass('hover');
	})

	$('.user').mouseleave(function() {
		$(this).removeClass('hover');
	});
</script>
<script src="../../oem/js/oem.js"></script>
